return Err(human(match find_closest(config, cmd) {
Some(closest) => format!("no such subcommand: `{}`\n\n\t\
Did you mean `{}`?\n", cmd, closest),
- None => "no such subcommand".to_string()
+ None => format!("no such subcommand: `{}`", cmd)
}).into())
}
};
assert_that(pr,
execs().with_status(101)
- .with_stderr("[ERROR] no such subcommand
+ .with_stderr("[ERROR] no such subcommand: `biuld`
<tab>Did you mean `build`?
assert_that(pr,
execs().with_status(101)
- .with_stderr("[ERROR] no such subcommand
+ .with_stderr("[ERROR] no such subcommand: `there-is-no-way-that-there-is-a-command-close-to-this`
+"));
+}
+
+#[test]
+fn displays_subcommand_on_error() {
+ let mut pr = cargo_process();
+ pr.arg("invalid-command");
+
+ assert_that(pr,
+ execs().with_status(101)
+ .with_stderr("[ERROR] no such subcommand: `invalid-command`
"));
}